<div id="content-wrapper" class="corner">
<h1>Users List  <a href="<?php echo url_for('users/new') ?>">| New</a></h1>
 <?php foreach ($users as $user): ?>
<span class="list-item">
	<span class="item-id"><a href="<?php echo url_for('users/show?id_user='.$user->getIdUser()) ?>"><?php echo $user->getIdUser() ?></a></span>
     <span class="titulo-item"><a href=""><?php echo $user->getLogin() ?></a></span>&nbsp;&nbsp;&nbsp;&nbsp;
     <span class="titulo-item">Email: <span class="item-result"><?php echo $user->getEmail() ?></span></span>
     <span class="titulo-item">Phone:<span class="item-result"> <?php echo $user->getPhone() ?></span></span>
     <span class="titulo-item">Credential: <span class="item-result"><?php switch ($user->getCredential()) :
                case 1:
                    echo 'Administrator';
                    break;
                case 2:
                    echo 'Company';
                    break;
                case 3:
                    echo 'Regular User';
                    break;
              endswitch; 
        ?></span></span>
       <span class="titulo-item">Company name: <span class="item-result"><?php echo $user->Account->getAccountName() ?></span></span>
</span>
<table style="display:none;">
  <thead>
    <tr>
      <th>Id user</th>
      <th>Name</th>
      <th>Last name</th>
      <th>Login</th>
      <th>Email</th>
      <th>Cel Phone</th>
      <th>Phone number</th>
      <th>Credential</th>
      <th>Account</th>
    </tr>
  </thead>
  <tbody>
   
    <tr>
      <td><a href="<?php echo url_for('users/show?id_user='.$user->getIdUser()) ?>"><?php echo $user->getIdUser() ?></a></td>
      <td><?php echo $user->getName() ?></td>
      <td><?php echo $user->getLastName() ?></td>
      <td><?php echo $user->getLogin() ?></td>
      <td><?php echo $user->getEmail() ?></td>
      <td><?php echo $user->getMobile() ?></td>
      <td><?php echo $user->getPhone() ?></td>
      <td>
        <?php switch ($user->getCredential()) :
                case 1:
                    echo 'Administrator';
                    break;
                case 2:
                    echo 'Company';
                    break;
                case 3:
                    echo 'Regular User';
                    break;
              endswitch; 
        ?>
      </td>
      <td><?php echo $user->Account->getAccountName() ?></td>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>

<div class="pagination">
<?php if ($pager->haveToPaginate()): ?>
  <span><?php echo 'Showing from '.$pager->getFirstIndice().' to '.$pager->getLastIndice().' of '.$pager->count().' users'; ?></span><br/>
  <?php if (!$pager->isFirstPage()) :  ?>
  <a href="<?php echo url_for('users/index') ?>"><?php echo 'First' ?></a>

  <a href="<?php echo url_for('users/index') ?>?page=<?php echo $pager->getPreviousPage() ?>"><?php echo 'Previous' ?></a>
  <?php endif; ?>

  <?php foreach ($pager->getLinks() as $page): ?>
    <?php if ($page == $pager->getPage()): ?>
      <?php echo $page ?>
    <?php else: ?>
      <a href="<?php echo url_for('users/index') ?>?page=<?php echo $page ?>"><?php echo $page ?></a>
    <?php endif; ?>
  <?php endforeach; ?>

  <?php if (!$pager->isLastPage()) :  ?>
  <a href="<?php echo url_for('users/index') ?>?page=<?php echo $pager->getNextPage() ?>"> <?php echo 'Next' ?></a>

  <a href="<?php echo url_for('users/index') ?>?page=<?php echo $pager->getLastPage() ?>"><?php echo 'Last' ?></a>
  <?php endif; ?>

<?php endif; ?>
</div>
</div>
  
